<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>后台登录-X-admin1.1</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="__PUBLIC__/admin/css/font.css">
    <link rel="stylesheet" href="__PUBLIC__/admin/css/xadmin.css">
    <link rel="stylesheet" href="https://cdn.bootcss.com/Swiper/3.4.2/css/swiper.min.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="https://cdn.bootcss.com/Swiper/3.4.2/js/swiper.jquery.min.js"></script>
    <script src="__PUBLIC__/admin/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__PUBLIC__/admin/js/xadmin.js"></script>

</head>
<body>
    <!-- 中部开始 -->
    <div class="wrapper">
        <!-- 右侧主体开始 -->
        <div class="page-content">
          <div class="content">
            <!-- 右侧内容框架，更改从这里开始 -->
            <form class="layui-form">
                <div class="layui-form-item">
                    <label for="L_username" class="layui-form-label">礼卷名</label>
                    <div class="layui-input-inline">
                        <input type="text" autocomplete="off" placeholder="输入礼卷名" name="title" value="" class="layui-input">
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline" style="padding-top: 10px;font-size: 8px;color: red;">
                            <span>例如：1对1辅导9课时</span>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_username" class="layui-form-label">标签名</label>
                    <div class="layui-input-inline">
                        <input type="text" autocomplete="off" placeholder="输入标签名" name="xioc" value="" class="layui-input">
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline" style="padding-top: 10px;font-size: 8px;color: red;">
                            <span>例如：9课时</span>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label for="L_sign" class="layui-form-label"></label>
                    <input type="hidden" name="uid" value="{$uid}">
                    <button class="layui-btn" key="set-mine" lay-filter="save" lay-submit>添加</button>
                </div>
            </form>
            <!-- 右侧内容框架，更改从这里结束 -->
          </div>
        </div>
        <!-- 右侧主体结束 -->
    </div>
    <!-- 中部结束 -->
        <script>
            layui.use(['form','layer'], function(){
                $ = layui.jquery;
              var form = layui.form()
              ,layer = layui.layer;

              //监听提交
              form.on('submit(save)', function(data){
                //发异步，把数据提交给php
                $.ajax({
                    url: "{:U('admin/user/addlw')}",//请求地址
                    type: "post",//请求方式
                    dataType: "json",//返回数据类型
                    data: data.field,//发送的参数
                    })
                    .done(function(response) {
                          if(response.error==0){
                             layer.msg(response.info ,{icon:5});
                          }else{
                            layer.alert(response.info, {icon: 6},function () {
                                // 获得frame索引
                                var index = parent.layer.getFrameIndex(window.name);
                                //关闭当前frame
                                parent.layer.close(index);
                                parent.location.reload();
                            });
                          }
                      })
                    .fail(function() {
                        alert("ajxs交互失败");
                    })  

                return false;
              });
              
            });
        </script>
</body>
</html>